import Quick from ".";
import { WeaSelect, WeaLocaleProvider } from 'ecCom';
import { each } from 'lodash';
const { getLabel } = WeaLocaleProvider;
export default class Main extends Quick {
    state = {
        value: ''
    }
    getComponent = () => {
        const { value } = this.state;
        const events = [];
        if (window.GC) {
            each(window.GC.Spread.Sheets.Events, (key, showname) => {
                events.push({
                    key,
                    showname
                })
            })
        }

        return (
            <div>
                <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@z6mqv0`}
                    style={{ minWidth: 200 }}
                    options={events}
                    value={value}
                    showSearch={true}
                    optionFilterProp="children"
                    onChange={v => this.setState({ value: v })}
                    placeholder={getLabel('511720','请选择事件类型')}
                />
            </div>
        )
    }
    getTitle = () => {
        return 'excel.bind';
    }
    getScript = () => {
        return `excel.bind('${this.state.value}', function(e, info){\n\n});`
    }
}